/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"5B39CAC6-BF1A-4E7E-BDA8-10FE02D0D69C",variableType:4}
 */
var fmoneda = null;

/**
 * Perform the element default action.
 *
 * @param {JSEvent} [event] the event that triggered the action
 *
 * @properties={typeid:24,uuid:"ADF4451B-A3BC-411C-975B-4D5EA5DDC7F1"}
 * @AllowToRunInFind
 */
function onAction(event) {
	//databaseManager.setAutoSave(false)
	var estado = controller.find()
	if (estado == false)
	{
		globals.DIALOGS.showWarningDialog("Aviso","Error al hacer el find","Ok")
		return
	}
	moneda = 2
	var fdes = utils.dateFormat(globals.gFechaDesde,"dd-MM-yyyy")
	var fhas = utils.dateFormat(globals.gFechaHasta,"dd-MM-yyyy")
	var selec_fecha = "#" + fdes + "..." + fhas + "|dd-MM-yyyy"
	fecha =  selec_fecha 
	var cuantos = controller.search()
	if (cuantos == 0)
	{
		globals.DIALOGS.showWarningDialog("Aviso","Sin cotizaciones entre fechas","Ok")
		return		
	}
	controller.sort("fecha asc")	
}

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"C3D8012A-998C-439A-9D3B-B4210A86D560"}
 */
function onShow(firstShow, event) {
	globals.gvarios = 3
	fmoneda = 2
	//moneda = fmoneda
	globals.gFechaHasta = new Date ()	
	var fanio = globals.gFechaHasta.getFullYear() 
	var fmes = globals.gFechaHasta.getMonth() 
	var fdia = globals.gFechaHasta.getDate()
	globals.gFechaDesde = new Date (fanio, fmes, fdia - 10)
	onAction()
	controller.sort("fecha desc")
}
